using Newtonsoft.Json;
namespace StateManagement {
  public static class Utils {//Utility class
    public static void SetObject(this ISession session, string key, object value) {
      session.SetString(key, JsonConvert.SerializeObject(value));
    }

    public static T GetObject<T>(this ISession session, string key) {
      var value = session.GetString(key);
      return value == null ? default(T) : JsonConvert.DeserializeObject<T>(value);
    }
  }
}
